package pl.makowski.neotripletriad;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Gallery;
import android.widget.ImageView;

public class MenuAdapter extends BaseAdapter {
	private Context mContext;
	private Integer[] menuItemIDs = {
			R.drawable.new_game,
			R.drawable.pvp,
			R.drawable.library,
			R.drawable.options
	};
	
	public MenuAdapter(Context c) {
		mContext = c;
	}
	
	@Override
	public int getCount() {
		return menuItemIDs.length;
	}

	@Override
	public Object getItem(int position) {
		return menuItemIDs[position];
	}

	@Override
	public long getItemId(int position) {
		return menuItemIDs[position];
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		ImageView imageView = new ImageView(mContext);
		imageView.setImageResource(menuItemIDs[position]);
        imageView.setLayoutParams(new Gallery.LayoutParams(150, 100));
        imageView.setScaleType(ImageView.ScaleType.FIT_XY);

        return imageView;
	}

}
